package com.heima.Config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import static com.heima.common.exception.RabbitMQcode.*;

@Configuration
public class MQConfig {
    @Bean
    public DirectExchange AdminExchange()
    {
        return new DirectExchange(AdminExchangeName);
    }

    @Bean
    public Queue AdminScanQueue()
    {
        return new Queue(AdminScanQueueName);
    }

    @Bean
    public Binding AdminScanBinding(Queue AdminScanQueue,DirectExchange AdminExchange)
    {
        return BindingBuilder.bind(AdminScanQueue).to(AdminExchange).with(AdminScanKeyword);
    }

}
